﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 逻辑
{
    public class 士 :  QiZi
    {
        public 士( int x, int y, QiPan q, Button[,] b,int p) : base("士", x, y, q, p, b)
        {
        }
        public override void CanPut()
        {
            canPut.Clear();
            if ((x + 1 <= 2 && x + 1 >= 0 && y + 1 <= 5 && y + 1 >= 3) && (buttons[x + 1, y + 1].Tag == null || (buttons[x + 1, y + 1].Tag as QiZi).Player != this.Player))
            {
                int z = Game.ChangeDirection(this.Player, x + 1);
                canPut.Add(z * 10 + y + 1);
            }
            if ((x - 1 <= 2 && x - 1 >= 0 && y + 1 <= 5 && y + 1 >= 3) && (buttons[x - 1, y + 1].Tag == null || (buttons[x - 1, y + 1].Tag as QiZi).Player != this.Player))
            {
                int z = Game.ChangeDirection(this.Player, x - 1);
                canPut.Add(z * 10 + y + 1);
            }
            if ((x + 1 <= 2 && x + 1 >= 0 && y - 1 <= 5 && y - 1 >= 3) && (buttons[x + 1, y - 1].Tag == null || (buttons[x + 1, y - 1].Tag as QiZi).Player != this.Player))
            {
                int z = Game.ChangeDirection(this.Player, x + 1);
                canPut.Add(z * 10 + y - 1);
            }
            if ((x - 1 <= 2 && x - 1 >= 0 && y - 1 <= 5 && y - 1 >= 3) && (buttons[x - 1, y - 1].Tag == null || (buttons[x - 1, y - 1].Tag as QiZi).Player != this.Player))
            {
                int z = Game.ChangeDirection(this.Player, x - 1);
                canPut.Add(z * 10 + y - 1);
            }
        }
    }
}
